package com.stockz.ui.swing.charting.painter;

import java.awt.Graphics2D;
import java.awt.Rectangle;

import com.stockz.ui.swing.charting.painter.axis.PriceAxisPainter;
import com.stockz.ui.swing.charting.painter.axis.TimeAxisPainter;
import com.stockz.ui.swing.charting.view.StockChartPanel;

public class GridPainter{
	
	public static void paint(Graphics2D g,StockChartPanel view, Rectangle r) {
		int[] values = null;
		g.setColor(view.getStockChartPanelSkin().getGridColor());
		if(TimeAxisPainter.getCurrentXmarks() != null 
				&& TimeAxisPainter.getCurrentXmarks().length != 0){
			values = TimeAxisPainter.getCurrentXmarks();
			for(int x : values){
				g.drawLine(x, r.y, x, r.y + r.height);
			}
		}
		if(PriceAxisPainter.getCurrentYmarks() != null 
				&& PriceAxisPainter.getCurrentYmarks().length != 0){
			values = PriceAxisPainter.getCurrentYmarks();
			for(int y : values){
				g.drawLine(r.x, y, r.x +r.width, y);
			}
		}

	}
}
